<!doctype html>
<html>
<head>
  <meta charset="utf-8">
  <style>
    :root{--bg:#0e1420;--card:#121826;--text:#e7eef7;--muted:#8aa0b2;--primary:#3b82f6;--ok:#22c55e;--off:#94a3b8;--border:#1f2a3a;--shadow:0 8px 24px rgba(0,0,0,.35)}
    body{font-family:system-ui,Segoe UI,Arial;font-size:13px;margin:0;width:320px;background:linear-gradient(180deg,#0b1320,#0e1420);color:var(--text)}
    header{padding:14px 16px;border-bottom:1px solid var(--border);background:#0c1624}
    .title{font-weight:600;letter-spacing:.2px}
    .sub{color:var(--muted);font-size:12px;margin-top:2px}
    .section{margin:10px}
    .card{background:var(--card);border:1px solid var(--border);border-radius:12px;padding:12px;box-shadow:var(--shadow)}
    .row{display:flex;align-items:center;justify-content:space-between;margin:10px 0}
    .pill{padding:2px 10px;border-radius:14px;font-size:12px;border:1px solid var(--border)}
    .pill.ok{background:rgba(34,197,94,.18);color:var(--ok)}
    .pill.off{background:rgba(148,163,184,.18);color:var(--off)}
    input[type=text]{flex:1;min-width:0;background:#0b1320;border:1px solid #233044;color:var(--text);border-radius:8px;padding:8px}
    button{cursor:pointer;background:var(--primary);color:#fff;border:none;border-radius:8px;padding:8px 12px}
    button.secondary{background:#253244;color:#cbd5e1}
    .grid{display:grid;grid-template-columns:1fr auto;gap:10px}
    .list{display:flex;flex-direction:column;gap:6px;margin-top:8px}
    .chip{display:flex;flex-wrap:wrap;align-items:flex-start;gap:6px;background:#0b1524;border:1px solid #243246;color:#cbd5e1;padding:6px;border-radius:10px;width:100%;box-sizing:border-box}
    .chip span{word-break: break-all;overflow-wrap: anywhere;flex:1;min-width:0}
    .chip button{background:transparent;color:#93c5fd;border:none;padding:0 6px;cursor:pointer;align-self:flex-start}
    .chip button:hover{color:#60a5fa}
    .toolbar{display:flex;gap:10px}
    .switch{position:relative;display:inline-block;width:42px;height:22px}
    .switch input{opacity:0;width:0;height:0}
    .slider{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background:#2b3445;border:1px solid #3b475c;border-radius:999px;transition:.2s}
    .slider:before{content:"";position:absolute;height:18px;width:18px;left:2px;top:1px;background:#d1d5db;border-radius:50%;transition:.2s}
    .switch input:checked + .slider{background:#164b85;border-color:#1e61ac}
    .switch input:checked + .slider:before{transform:translateX(20px);background:#93c5fd}
    .toast{position:fixed;right:12px;top:12px;background:#0b1524;color:#e7eef7;padding:10px 12px;border-radius:10px;border:1px solid #243246;box-shadow:var(--shadow);opacity:.98}
    .toast.ok{background:#0f1f2f;border-color:#1e61ac;color:#93c5fd}
    .toast.off{background:#111827;border-color:#334155;color:#cbd5e1}
    footer{padding:8px 12px;color:var(--muted);font-size:11px}
  </style>
</head>
<body>
  <header>
    <div class="title">窗口置顶助手</div>
    <div class="sub">视频自动置顶与快捷操作</div>
  </header>
  <div class="section card">
    <div class="row">
      <span>状态</span>
      <span id="status" class="pill off">OFF</span>
    </div>
    <div class="row">
      <span>视频播放自动置顶</span>
      <label class="switch"><input type="checkbox" id="auto"><span class="slider"></span></label>
    </div>
    <div class="toolbar">
      <button id="primary">置顶</button>
      <button id="setup" class="secondary">授权扩展</button>
    </div>
  </div>
  <div class="section card">
    <div class="row">
      <span>当前站点</span>
      <span id="site">-</span>
    </div>
    <div class="grid">
      <input type="text" id="domain" placeholder="example.com">
      <button id="add">加入白名单</button>
    </div>
    <div class="sub" style="margin-top:6px">白名单为空时对所有站点生效</div>
    <div class="list" id="list"></div>
    <div class="toolbar" style="margin-top:8px">
      <button id="clear" class="secondary">清空白名单</button>
      <button id="more" class="secondary" style="display:none">展开全部</button>
    </div>
  </div>
  <div id="toast" class="toast" style="display:none"></div>
  <footer>快捷键 Alt+Shift+T 切换置顶</footer>
  <script src="popup.js"></script>
  </body>
  </html>
